<script setup>
import { useUserStore } from "@/stores";
import { storeToRefs } from "pinia";
const userStore = useUserStore();
const { repasswordForm } = storeToRefs(userStore);
const { clear, repasswordRules, changePassword } = userStore;
</script>

<template>
  <CardPage>
    <template #title> 重置密码 </template>
    <el-form
      size="large"
      label-width="5vw"
      :model="repasswordForm"
      :rules="repasswordRules"
    >
      <el-form-item label="原密码" prop="old_pwd">
        <el-input v-model="repasswordForm.old_pwd"></el-input>
      </el-form-item>
      <el-form-item label="新密码" prop="new_pwd">
        <el-input v-model="repasswordForm.new_pwd"></el-input>
      </el-form-item>
      <el-form-item label="确认新密码" prop="re_pwd">
        <el-input v-model="repasswordForm.re_pwd"></el-input>
      </el-form-item>
    </el-form>
    <el-button @click="changePassword" type="primary" style="margin-left: 5vw"
      >修改密码</el-button
    >
    <el-button @click="clear">重置</el-button>
  </CardPage>
</template>
<style scoped>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.el-form {
  width: 40%;
  height: 20vh;
  margin: 1vw;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.el-button {
  width: 5vw;
  height: 2vw;
}
</style>
